//! 透传协议

#![no_std]

use core::ops::Deref;

pub use unmp_protocol::*;

/// 协议ID
pub const PROTOCOL_ID: u8 = 0;

pub struct ProtocolRaw {
    ch: DataChannel,
}
impl ProtocolRaw {
    pub fn new(distributor: &mut Distributor) -> Option<ProtocolRaw> {
        let ch = distributor.register(PROTOCOL_ID)?;
        Some(Self { ch })
    }
    pub fn into_ch(self) -> DataChannel {
        self.ch
    }
}
impl Deref for ProtocolRaw {
    type Target = DataChannel;
    fn deref(&self) -> &Self::Target {
        &self.ch
    }
}
